package cn.tedu.medicalmanagementsystem.escort.mapper;


import cn.tedu.medicalmanagementsystem.escort.pojo.entity.EscortAppointment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;


@Mapper
public interface EscortAppointmentMapper {

    //陪诊员查看预约自己的用户信息
    List<EscortAppointment> findAppointmentsByEscortId(Long escortId);

    // 更新预约状态
    int updateStatusById(@Param("id") Long id, @Param("status") String status);

    EscortAppointment selectById(Long id);

    // 按月查询
    List<EscortAppointment> findAppointmentsByEscortIdAndMonth(
            @Param("escortId") Long escortId,
            @Param("month") Integer month,
            @Param("year") Integer year);

    // 新增：按具体日期查询
    List<EscortAppointment> findAppointmentsByEscortIdAndDate(
            @Param("escortId") Long escortId,
            @Param("date") LocalDate date);


    @Select("SELECT name FROM service_type WHERE id = #{id}")
    String getServiceTypeNameById(Long id);

    @Select("SELECT real_name FROM user WHERE id = #{id}")
    String getUserNameById(Long id);

}
